package com.sky.mapper;

import com.sky.entity.Dish;
import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 获取与菜品相关联的id
     * @param
     * @return
     */
    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);

    /**
     * 批量插入与套餐关联的菜品
     * @param setmealDishList
     */
    void insertBatch(List<SetmealDish> setmealDishList);

    /**
     * 根据id删除套餐菜品关系数据
     * @param setmealId
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void deleteBySetmealId(Long setmealId);

    /**
     * 根据id获取菜品信息
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where id = #{id}")
    List<SetmealDish> getSetmealDishedById(Long id);

    /**
     * 根据套餐id查询菜品id
     * @param setmealId
     * @return
     */
    List<Long> getDishIdsByMealId(Long setmealId);
}
